<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="java.time.LocalDate" %>
<%@ page import="java.time.format.DateTimeFormatter" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>玉灵 QQ:7031633 Email:webrx@126.com</title>
    <style>
        span{
            padding: 2px;
            margin: 2px;
            border-radius: 5px;
            border:1px dashed gray;
            font-size:12px;
            color: #838282;
        }
        span:hover{
            background-color: #000;
            color:#fff;
            cursor: pointer;
        }
    </style>
</head>

<body>
<%
    pageContext.setAttribute("name","张三丰");
    pageContext.setAttribute("birth", LocalDate.now());
    pageContext.setAttribute("age",String.format("%05d",13));
    pageContext.setAttribute("money",100.12345);
%>
${name}
<p>${age}</p>
<p>${birth}</p>
<%
    LocalDate d = (LocalDate) pageContext.getAttribute("birth");
    DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy年MM月dd日");
    out.print(d.format(df));
%>

<!-- java.util.Date -->
<fmt:formatDate value="<%=new java.util.Date()%>" pattern="MM月dd日"></fmt:formatDate>
<p>${money}</p>

<fmt:formatNumber value="${age}" pattern="000"/>

<c:forEach begin="1" end="30" var="i">
    <span><fmt:formatNumber value="${i}" pattern="000"/></span>
</c:forEach>
<hr>
<fmt:formatNumber value="100" pattern="0.00"/>
<fmt:formatNumber value=".019" pattern="0.00"/>
</body>
</html>
